<?php


namespace App\Models\CacheModel;


use App\Models\Api\BaseCache;

/**
 * 用户注销模型
 * Class ZlUserZx
 * @package App\Models\CacheModel
 */
class ZlUserZx extends BaseCache
{
    protected $table = 'wechat_backup_07_18_14_43_00.zl_user_xz';

    /**
     * 获取注销次数
     * @param int $type 注销方式 1=>微信，2=>qq,3=>微博 4=>手机号
     * @param string $value 注销标识
     * @return int|string
     * @throws \think\Exception
     */
    public function getZxNum($type, $value)
    {
//        $where = ['type' => $type];
        switch ($type)
        {
            case 4: // 手机号
                $where['tel'] = $value;
                break;
            case 1: // 微信
                $where = ['unionid' => $value];
                break;
            case 2: // QQ
                $where = ['qq_unionid' => $value];
                break;
            case 3: // 微博
                $where = ['wuid' => $value];
                break;
            case 5: // 微博
                $where = ['apple_id' => $value];
                break;
            default:
                return 0;
                break;
        }
        return $this->where($where)->count();
    }
}
